package com.atguigu.yygh.common.exception;

import com.atguigu.yygh.common.result.ResultCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created with IntelliJ IDEA
 *
 * @Date: 2022/12/6 - 15:37
 * @Author: Hyoung
 * @Description:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class YyghException extends RuntimeException {

    private static final long serialVersionUID = -7833697502166511811L;
    // 状态1码
    private Integer code;
    // 消息
    private String msg;


    public YyghException(Integer code, String msg, Throwable cause) {
        super(cause);
        this.code = code;
        this.msg = msg;
    }
    public YyghException(ResultCodeEnum code) {
        this.code = code.getCode();
        this.msg = code.getMessage();
    }
    public YyghException(ResultCodeEnum code, Throwable cause) {
        super(cause);
        this.code = code.getCode();
        this.msg = code.getMessage();
    }

}
